import { createWebHistory, createRouter } from "vue-router";
import Layout from "@/Layout/index.vue";
export const localRoutes = [
  {
    path: "/",
    name: "index",
    redirect: "home",
    component: Layout,
    meta: {
      name: "本地路由",
    },
    children: [
      {
        path: "/home",
        name: "home",
        component: () => import("@/views/Home.vue"),
        meta: {
          name: "首页",
        },
      },
      {
        path: "/about",
        name: "about",
        component: () => import("@/views/About.vue"),
        meta: {
          name: "关于",
        },
      },
    ],
  },
];

const routes = [
  ...localRoutes,
  {
    path: "/404",
    name: "notFound",
    component: () => import("@/views/404.vue"),
    meta: {
      name: "404",
    },
  },
  {
    path: "/:catchAll(.*)",
    component: Layout,
  },
];

const router = createRouter({
  history: createWebHistory("/"),
  routes,
});

export default router;
